﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Rodunu.Business.Models.Storage;
using Rodunu.Business.Models.ValueTypes;

namespace Rodunu.Business.Models.Movies
{
    [DataContract]
    [KnownType(typeof(DecimalWithUnits))]
    [KnownType(typeof(Role))]
    [KnownType(typeof(Director))]
    [KnownType(typeof(Language))]
    [KnownType(typeof(FileStorage))]
    [KnownType(typeof(MediaStorage))]
    public class Title
    {
        public Title()
        {
            Directors = new List<Director>();
            Runtime = new DecimalWithUnits();
            Cast = new List<Role>();
            Languages = new List<Language>();
            Tags = new Dictionary<string, bool>();
        }

        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public Int64 NetFlixId { get; set; }
        [DataMember]
        public bool SeenIt { get; set; }
        [DataMember]
        public string Name { get; set; }

        private string _origionalName;
        [DataMember]
        public string OriginalName
        {
            get
            {
                if (_origionalName == null)
                    _origionalName = string.Empty;
                return _origionalName;
            }
            set
            {
                _origionalName = value;
            }
        }
        [DataMember]
        public int Year { get; set; }
        [DataMember]
        public DecimalWithUnits Runtime { get; set; }
        [DataMember]
        public int Rating { get; set; }
        [DataMember]
        public string Plot { get; set; }
        [DataMember]
        public IList<Role> Cast { get; set; }
        [DataMember]
        public string Notes { get; set; }
        [DataMember]
        public IList<Director> Directors { get; set; }
        [DataMember]
        public IList<string> Countries { get; set; }
        [DataMember]
        public IList<string> Genres { get; set; }
        [DataMember]
        public string Classification { get; set; }
        [DataMember]
        public string Studio { get; set; }
        [DataMember]
        public string OfficialSite { get; set; }
        [DataMember]
        public string IMDB { get; set; }
        [DataMember]
        public string Amazon { get; set; }
        [DataMember]
        public Storage.FileStorage FileStorage { get; set; }
        [DataMember]
        public Storage.MediaStorage MediaStorage { get; set; }
        [DataMember]
        public IList<Language> Languages { get; set; }
        [DataMember]
        public IDictionary<string, bool> Tags { get; set; }
        [DataMember]
        public string ImageUrl { get; set; }
        [DataMember]
        public string TagLine { get; set; }
        [DataMember]
        public string ReleaseDate { get; set; }
        [DataMember]
        public string MPAARating { get; set; }
    }
}